package wall;

import java.awt.Rectangle;
import java.awt.image.BufferedImage;

import tankbullets.Bullet;
import tankbullets.EnemyBullet;

public class Wall {
	protected int x;
	protected int y;
	protected int width;
	protected int height;
	protected BufferedImage image;
	protected BufferedImage[] ember;
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public int getWidth() {
		return width;
	}
	public void setWidth(int width) {
		this.width = width;
	}
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	public BufferedImage getImage() {
		return image;
	}
	public void setImage(BufferedImage image) {
		this.image = image;
	}
	public BufferedImage[] getEmber() {
		return ember;
	}
	public void setEmber(BufferedImage[] ember) {
		this.ember = ember;
	}
	public boolean shootwBy(EnemyBullet b) {
		if(b.isBomb()){
			return false;
		}
		boolean shoot = b.getRectangle().intersects(this.getRectangle());
		if(shoot){
			b.setBomb(true);
		}
		return shoot;
	}
	private Rectangle getRectangle() {
		return new Rectangle(x, y, width, height);
	}
	public boolean shootwByH(Bullet b) {
		if(b.isBomb()){
			return false;
		}
		boolean shoot = b.getRectangle().intersects(this.getRectangle());
		if(shoot){
			b.setBomb(true);
		}
		return shoot;
	}
}
